package operation;

import book.BookList;

import java.util.Scanner;

public class FindOperation implements Operation{

    @Override
    public void work(BookList book) {
        System.out.println("查找图书");
        int currentSize = book.getUsedsize();
        System.out.println("请输入你要查找的书名：");
        Scanner sc = new Scanner(System.in);
        String findName = sc.nextLine();
        for (int i = 0; i < currentSize; i++) {
            String bookName = book.getBooks(i).getName();
            if (findName.equals(bookName)) {
                System.out.println("找到了：");
                System.out.println(book.getBooks(i));
                return;
            }
        }
        System.out.println("没有找到");

    }
}
